let timer: any;
export function debounce (fn: ()=> void) {
    if(timer) clearTimeout(timer);
    timer = setTimeout(() => {
        fn();
    }, 300);
}
export function setDebounce(fn: ()=> void, wait: number) {
    return function() {
        if(timer) clearTimeout(timer);  //清除这个定时器
        timer = setTimeout(fn, wait);
    };
}